-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permit multiple data subscriptions per original topic #128
Permit multiple data subscriptions per original topic #128
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👍
Confirmed that this fixes the go-data-transfer test |
Co-authored-by: dirkmc <dirkmdev@gmail.com>
closes #126
Motivation
When we add new data topics, we would map the block topic to a response topic on the subscriber. It is possible for multiple blocks to go out in one response, however, so the subscriptions would overwrite each other.
This PR first refactors the subscription system to remove the concept of mapping and replace it with the concept of data topics. It then modifies the subscriber to permit multiple data subscribers per topic and ensure that each of these data subscribers is notified when a topic event is published.
Proposed Changes
MappableSubscriber
interface because there only needs to be one implementation.TopicData
to slightly distinguish data subscriptions from the original topic subscription. This replaces the mappable topic.notifications.SubscribeOn
tonotifications.SubscribeWithData
for clarity.mappable.go
todata_subscriber.go
and renamemappableSubscriber
toTopicDataSubscriber
.Notifee
'stopic
with adata
field of typeTopicData
.mappableSubscriber
'sidMap
withTopicDataSubscriber
'sdata
which is now a map of topics to multipleTopicData
s.DataSubscriber
'sOnNext
and andOnClose
now call the corresponding methods on the internal subscriber once for eachTopicData
mapped to the original topic. This fixes block sent listener is not called for every block sent #126.RegisterBlockSentListener
will get called once for every block actually sent (i.e. that block sent listener is not called for every block sent #126 has been fixed). This test failed before the last two changes.cc @dirkmc